\(\int \csc (c+d x) (a+b \tan (c+d x)) \, dx\) [16]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 26 \[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {a \text {arctanh}(\cos (c+d x))}{d}+\frac {b \text {arctanh}(\sin (c+d x))}{d} \]

[Out]

-a*arctanh(cos(d*x+c))/d+b*arctanh(sin(d*x+c))/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3598, 3855} \[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {a \text {arctanh}(\cos (c+d x))}{d} \]

[In]

Int[Csc[c + d*x]*(a + b*Tan[c + d*x]),x]

[Out]

-((a*ArcTanh[Cos[c + d*x]])/d) + (b*ArcTanh[Sin[c + d*x]])/d

Rule 3598

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[Expand[Sin[e
+ f*x]^m*(a + b*Tan[e + f*x])^n, x], x] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] && IGtQ[n, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \int (a \csc (c+d x)+b \sec (c+d x)) \, dx \\ & = a \int \csc (c+d x) \, dx+b \int \sec (c+d x) \, dx \\ & = -\frac {a \text {arctanh}(\cos (c+d x))}{d}+\frac {b \text {arctanh}(\sin (c+d x))}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 52, normalized size of antiderivative = 2.00 \[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {a \log \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}{d}+\frac {a \log \left (\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}{d} \]

[In]

Integrate[Csc[c + d*x]*(a + b*Tan[c + d*x]),x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d - (a*Log[Cos[c/2 + (d*x)/2]])/d + (a*Log[Sin[c/2 + (d*x)/2]])/d

Maple [A] (verified)

Time = 0.45 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.54

method result size
derivativedivides \(\frac {b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}\) \(40\)
default \(\frac {b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}\) \(40\)
risch \(-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(74\)

[In]

int(csc(d*x+c)*(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(b*ln(sec(d*x+c)+tan(d*x+c))+a*ln(csc(d*x+c)-cot(d*x+c)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 58 vs. \(2 (26) = 52\).

Time = 0.28 (sec) , antiderivative size = 58, normalized size of antiderivative = 2.23 \[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {a \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - a \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - b \log \left (\sin \left (d x + c\right ) + 1\right ) + b \log \left (-\sin \left (d x + c\right ) + 1\right )}{2 \, d} \]

[In]

integrate(csc(d*x+c)*(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/2*(a*log(1/2*cos(d*x + c) + 1/2) - a*log(-1/2*cos(d*x + c) + 1/2) - b*log(sin(d*x + c) + 1) + b*log(-sin(d*
x + c) + 1))/d

Sympy [F]

\[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right ) \csc {\left (c + d x \right )}\, dx \]

[In]

integrate(csc(d*x+c)*(a+b*tan(d*x+c)),x)

[Out]

Integral((a + b*tan(c + d*x))*csc(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.77 \[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=\frac {b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 2 \, a \log \left (\cot \left (d x + c\right ) + \csc \left (d x + c\right )\right )}{2 \, d} \]

[In]

integrate(csc(d*x+c)*(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) - 2*a*log(cot(d*x + c) + csc(d*x + c)))/d

Giac [A] (verification not implemented)

none

Time = 0.35 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.88 \[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=\frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{d} \]

[In]

integrate(csc(d*x+c)*(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

(b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + a*log(abs(tan(1/2*d*x + 1/2*c))
))/d

Mupad [B] (verification not implemented)

Time = 4.51 (sec) , antiderivative size = 86, normalized size of antiderivative = 3.31 \[ \int \csc (c+d x) (a+b \tan (c+d x)) \, dx=\frac {a\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {2\,b\,\mathrm {atanh}\left (\frac {b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \]

[In]

int((a + b*tan(c + d*x))/sin(c + d*x),x)

[Out]

(a*log(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (2*b*atanh((b*cos(c/2 + (d*x)/2) - a*sin(c/2 + (d*x)/2))/(a
*cos(c/2 + (d*x)/2) - b*sin(c/2 + (d*x)/2))))/d